package com.guang.springbootrequestversion.config;

import com.guang.springbootrequestversion.bean.Man;
import com.guang.springbootrequestversion.bean.Wife;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author liguang
 * @date 2022/5/10 13:57
 */
@Configuration
@EnableConfigurationProperties(value=MyDog.class) // 1、开启MyDog的自动绑定功能；2、将MyDog注册到容器中去
public class MyConfig {

    @Bean
    public Man man(Wife wife){
        System.out.println("这里会从容器中来进行查找wife"+wife);
        Man man = new Man();
        man.setWife(wife);
        return man;
    }

    @Bean
    public Wife wife(){
        Wife wife = new Wife();
        System.out.println(wife);
        return wife;
    }

}
